package config

import (
	baseAuth "gitee.com/zaiqiang231/go-base-app/base_app/auth"
	baseConfig "gitee.com/zaiqiang231/go-base-app/base_app/config"
	"time"
)

var (
	GlobalAppConfig = new(AppConfig)
	ServiceName     = "zcamp-service-user"
)

var (
	GlobalJwtAuth   *baseAuth.JWTAuth
	AuthIdentityKey = "username"
)

type AppConfig struct {
	baseConfig.AppConfig `mapstructure:",squash"` //结构体的字段提到父结构中
	CaptchaConfig        *CaptchaConfig           `mapstructure:"captcha"`
	IdGenFactor          float64                  `mapstructure:"id-gen-factor"`
	IdMqBaseSize         int64                    `mapstructure:"id-mq-base-size"`
	DefaultIdBegin       int64                    `mapstructure:"default-id-begin"`
	RobotUidStart        uint64                   `mapstructure:"robot-uid-start"`
	RobotUidEnd          uint64                   `mapstructure:"robot-uid-end"`
	RobotUidRange        int                      `mapstructure:"robot-uid-range"`
}

type CaptchaConfig struct {
	KeyLong            int           `mapstructure:"key-long"`
	ImgWidth           int           `mapstructure:"img-width"`
	ImgHeight          int           `mapstructure:"img-height"`
	OpenCaptcha        int           `mapstructure:"open-captcha"`
	OpenCaptchaTimeOut time.Duration `mapstructure:"open-captcha-timeout"`
}
